package com.yang.action;

import com.yang.service.CategoryService;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.yang.util.RespEntity;
import com.yang.util.RespUtil;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

@WebServlet("/queryCategory")
public class CategoryQueryAction extends HttpServlet {
    CategoryService categoryService = new CategoryService();

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //调用service的方法
        RespEntity respEntity = categoryService.queryCategory();
        RespUtil.sendJSON(resp,respEntity);
    }
}

